using System;
using System.Collections.Generic;
using System.Text;
using Ghasam.Business.Domain.Entity;
using Ghasam.Business.DAO;
using Spring.Transaction.Interceptor;

namespace Ghasam.Business.Services.Impl
{
    public class OverTimeWorkPaymentService:IOverTimeWorkPaymentService
    {
        private IOverTimeWorkDao iOverTimeWorkDao;
        private IEmployeePaymentDao iEmployeePaymentDao;
        private IEmployeeDao iEmployeeDao;

        public IEmployeePaymentDao IEmployeePaymentDao
        {
            set { iEmployeePaymentDao = value; }
            get { return iEmployeePaymentDao; }

        }

        public IOverTimeWorkDao IOverTimeWorkDao
        {
            set { iOverTimeWorkDao = value; }
            get { return iOverTimeWorkDao; }

        }
        public IEmployeeDao IEmployeeDao
        {
            set { iEmployeeDao = value; }
            get { return iEmployeeDao; }

        }
        [Transaction(ReadOnly = false)]
        public void OverTimeWorkSaveOrUpdate(int employeeId, float hours, DateTime overTimeWorkStartDate, DateTime overTimeWorkEndDate, bool holiday, bool nightly)
        {
            OverTimeWork overTimeWork = new OverTimeWork();
            overTimeWork.Holiday = holiday;
            overTimeWork.Hours = hours;
            overTimeWork.Nightly = nightly;
            overTimeWork.OverTimeWorkEndDate = overTimeWorkEndDate;
            overTimeWork.OverTimeWorkStartDate = overTimeWorkStartDate;
            Employee employee = 
            overTimeWork.Employee = IEmployeeDao.FindById(employeeId);
            IOverTimeWorkDao.SaveOrUpdate(overTimeWork);
        }

    }
}
